package com.pro.service.imple;

import com.pro.mapper.JsCarouselMapper;
import com.pro.pojo.JsCarousel;
import com.pro.service.JsCarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsJsCarouselServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2022/1/25 19:03
 * @Author: XJR
 */
@Service
public class JsCarouselServiceImple implements JsCarouselService {

    @Autowired
    private JsCarouselMapper mapper;

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/26
     * @Content:查看轮播图列表详情
     */
    public List<JsCarousel> selectJsCarousel(String imgType, String display,Integer limit,Integer page){
        page = (page-1)*limit;
        List<JsCarousel> jsCarousels = mapper.selectJsCarousel(imgType, display,limit,page);
        return jsCarousels;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/26
     * @Content:查看轮播图列表总数
     */
    public Integer countJsCarousel(String imgType,String display){
        Integer integer = mapper.countJsCarousel(imgType, display);
        return integer;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/2/2
     * @Content:通过id查询轮播图详细信息
     */
    public JsCarousel selectJsCarouselById(Integer carouselId){
        JsCarousel jsCarousel = mapper.selectJsCarouselById(carouselId);
        return jsCarousel;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/2/2
     * @Content:编辑轮播图信息
     */
    public Boolean updateJsCarousel(JsCarousel jsCarousel){
        Boolean updateBoolean = mapper.updateJsCarousel(jsCarousel);
        return updateBoolean;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/2/2
     * @Content:通过id删除轮播图
     */
    public Boolean delJsCarouselById(Integer carouselId){
        Boolean delBoolean = mapper.delJsCarouselById(carouselId);
        return delBoolean;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/2/2
     * @Content:添加轮播图
     */
    public Boolean addJsCarousel(JsCarousel jsCarousel){
        Boolean addBoolean = mapper.addJsCarousel(jsCarousel);
        return addBoolean;
    };
}
